package xa.woniu.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVO<E> implements Serializable {
    private Integer code;
    private String message;
    private E e;
    public static <E> ResultVO<E> success(String message,E object){
        ResultVO resultVO = new ResultVO(Constants.SUCCESS_CODE,message,object);
        return resultVO;
    }

    public static <E> ResultVO<E> success(String message){
        ResultVO resultVO = new ResultVO(Constants.SUCCESS_CODE,message,null);
        return resultVO;
    }

    public static <E> ResultVO<E> fail(String message){
        ResultVO resultVO = new ResultVO(Constants.FAIL_CODE,message,null);
        return resultVO;
    }

    public static <E> ResultVO<E> fail(String message,E object){
        ResultVO resultVO = new ResultVO(Constants.FAIL_CODE,message,object);
        return resultVO;
    }
}
